import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';

export namespace BookingResourceConstraintCheckApi {
  /** 资源约束检查信息 */
  export interface BookingResourceConstraintCheck {
    id: number; // 约束检查记录ID
    bookingOrderId?: number; // 预约订单ID
    orderDetailId: number; // 订单明细ID
    resourceRequirementId: number; // 资源需求ID
    checkPhase?: string; // 检查阶段
    checkType?: string; // 检查类型
    checkStatus?: string; // 检查状态
    checkTime?: string | Dayjs; // 检查时间
    checkerId: number; // 检查人ID
    checkResult: string; // 检查结果详情
    violationDetails: string; // 违反详情
    suggestedSolutions: string; // 建议解决方案
    resolutionStatus: string; // 处理状态
    resolutionAction: string; // 处理动作
    resolutionNotes: string; // 处理备注
    resolutionTime: string | Dayjs; // 处理时间
    resolverId: number; // 处理人ID
  }
}

/** 查询资源约束检查分页 */
export function getBookingResourceConstraintCheckPage(params: PageParam) {
  return requestClient.get<PageResult<BookingResourceConstraintCheckApi.BookingResourceConstraintCheck>>('/spa/booking-resource-constraint-check/page', { params });
}

/** 查询资源约束检查详情 */
export function getBookingResourceConstraintCheck(id: number) {
  return requestClient.get<BookingResourceConstraintCheckApi.BookingResourceConstraintCheck>(`/spa/booking-resource-constraint-check/get?id=${id}`);
}

/** 新增资源约束检查 */
export function createBookingResourceConstraintCheck(data: BookingResourceConstraintCheckApi.BookingResourceConstraintCheck) {
  return requestClient.post('/spa/booking-resource-constraint-check/create', data);
}

/** 修改资源约束检查 */
export function updateBookingResourceConstraintCheck(data: BookingResourceConstraintCheckApi.BookingResourceConstraintCheck) {
  return requestClient.put('/spa/booking-resource-constraint-check/update', data);
}

/** 删除资源约束检查 */
export function deleteBookingResourceConstraintCheck(id: number) {
  return requestClient.delete(`/spa/booking-resource-constraint-check/delete?id=${id}`);
}


/** 导出资源约束检查 */
export function exportBookingResourceConstraintCheck(params: any) {
  return requestClient.download('/spa/booking-resource-constraint-check/export-excel', { params });
}

